package top.withwings.bonus;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import top.withwings.bonus.bonus.pojo.BonusForm;
import top.withwings.bonus.bonus.service.BonusFormService;
import top.withwings.bonus.bonus.service.GoodService;
import top.withwings.bonus.common.service.UserService;

import java.util.Date;

@RunWith(SpringRunner.class)
@SpringBootTest
public class BonusFormTestService {

    @Autowired private BonusFormService bonusFormService;

    @Autowired private GoodService goodService;

    @Autowired private UserService userService;

    @Test
    public void testCreate(){
        BonusForm bonusForm = new BonusForm();

        bonusForm.setGood(goodService.findById(2));
        bonusForm.setSalesman(userService.findById(4));
        bonusForm.setBatchNo("");
        bonusForm.setEffectiveDate(new Date());
        bonusForm.setMakeUp(0);
        bonusForm.setPrice(120);
        bonusForm.setQuantity(2);
        bonusForm.setRemark("");
        bonusFormService.create(bonusForm);
    }
}
